D3c: -R URL forms + .git stripping + :443 normalization (C16+C17+C24)#7
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three MED findings from the C-audit, all about gh-compat parsing leniency on user-supplied repo + hostname strings. Cohesive surface (one parser + one normalizer); independent tests.
-R "https://shithub.sh/owner/repo"and-R "git@shithub.sh:owner/repo.git"were rejected with "repo: expected owner/name". gh accepts both. Now:ParseRepoArgroutes URL-shaped inputs throughinternal/git.ParseRemoteURL(which already handles HTTPS, HTTP, SSH, and the SCP-like git@ form).-R "owner/repo.git"(trailing.gitfromgit remote get-url) wasn't stripped and produced a 404 against/repos/owner/repo.git. Now trimmed.--hostname "shithub.sh:443"errored "no token configured" instead of finding the configuredshithub.shentry.NormalizeHostnow strips the default HTTPS port (:443) but leaves non-default ports intact.Test plan
TestParseRepoArgextended with 6 new cases: HTTPS+.git, HTTPS bare, SSH.git, SSH bare, bare.git, host-prefixed.git.https://shithub.sh/onlyowner(no repo segment) still errors.TestNormalizeHostextended with 3 cases for:443stripping (bare, HTTPS-prefixed, mixed-case).TestNormalizeHostRejectsMalformedcases still reject (no:443strip-then-accept on malformed inputs).make cigreen locally.Notes
The URL-detection heuristic (
isLikelyURL) is conservative — it only flips to the URL parser when the input contains://or the SCP-likeuser@host:form. Bareowner/repostrings with no special chars stay on the existing path so the change is purely additive.